/*
 * @Author: zhouyaxue
 * @Date: 2022-10-19 14:27:58
 * @LastEditors: zhouyaxue
 * @LastEditTime: 2022-12-05 09:46:58
 */
export default (app:any) => {
  app.directive('preventReClick', {
    mounted (el:any, binding:any) {
      if (el) {
        el.addEventListener('click', () => {
          if (!el.disabled) {
            el.disabled = true;
            setTimeout(() => {
              if (el) {
                el.disabled = false;
              }
            }, binding.value || 2000);
          }
        });
      }
    }
  });
};
